VERSION 5.00
Begin VB.Form ClinicClientForm 
   BackColor       =   &H00FFFFFF&
   BorderStyle     =   0  'None
   ClientHeight    =   9000
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   12000
   LinkTopic       =   "Form1"
   ScaleHeight     =   9000
   ScaleWidth      =   12000
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Cancel_Button 
      BackColor       =   &H008080FF&
      Caption         =   "Cancel"
      BeginProperty Font 
         Name            =   "Arial Narrow"
         Size            =   20.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Left            =   9600
      Style           =   1  'Graphical
      TabIndex        =   3
      Top             =   7560
      Width           =   1935
   End
   Begin VB.CommandButton Next_Button 
      Caption         =   "Next"
      BeginProperty Font 
         Name            =   "Arial Narrow"
         Size            =   20.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Left            =   9600
      TabIndex        =   2
      Top             =   6360
      Width           =   1935
   End
   Begin VB.CommandButton Clear_Button 
      Caption         =   "Clear"
      BeginProperty Font 
         Name            =   "Arial Narrow"
         Size            =   20.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Left            =   9600
      TabIndex        =   1
      Top             =   5160
      Visible         =   0   'False
      Width           =   1935
   End
   Begin VCT.TouchScreenListBox ClinicWaitingList 
      Height          =   7575
      Left            =   480
      TabIndex        =   0
      Top             =   960
      Width           =   5535
      _ExtentX        =   9763
      _ExtentY        =   13361
   End
   Begin VB.Label Label2 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Clients who have been referred to the during the post-test counseling session."
      BeginProperty Font 
         Name            =   "Arial Narrow"
         Size            =   18
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   555
      Left            =   180
      TabIndex        =   4
      Top             =   240
      Width           =   11715
   End
End
Attribute VB_Name = "ClinicClientForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim VisitIDArray(0 To 200)

Private Sub Cancel_Button_Click()
   VCTStageForm.Show
   Unload Me
End Sub

Private Sub ClinicWaitingList_click()
   Next_Button.Enabled = True
   VISITID = VisitIDArray(ClinicWaitingList.ListIndex)
End Sub

Private Sub Form_Load()
   Dim Loc_Sex As String
   Dim Loc_Index As Integer
   
   Next_Button.Enabled = False
   'Find all patients registered today who were referred to the MACRO clinic during the posttest counseling session
   Loc_Index = 0
   CnUser.Open ConnectString
   Cmd.CommandText = "SELECT CLNTCODE, SEX, TIMEREG, VISITID" _
                  & " FROM   client" _
                  & " WHERE  VDATE = '" & StringDate & "'" _
                  & " AND SITE = '" & SiteCodeConst & "'" _
                  & " AND TIMECLNC IS NULL" _
                  & " AND (VISITTYP = '3' OR (VISITTYP <> '3'" _
                  & " AND TIMEPOST IS NOT NULL" _
                  & " AND (REFTO7 = '1' OR REFERRED <>'0')))" _
                  & " ORDER BY TIMEREG DESC"
   Cmd.CommandType = adCmdText
   Cmd.ActiveConnection = CnUser
   RsUser.Open Cmd, , adOpenStatic
   While RsUser.EOF = False
      If RsUser(1) = "1" Then
         Loc_Sex = "M"
      Else
         If RsUser(1) = "2" Then
            Loc_Sex = "F"
         Else
            Loc_Sex = "?"
         End If
      End If
      ClinicWaitingList.AddItem RsUser(0) & " (" & Loc_Sex & ")"
      VisitIDArray(Loc_Index) = RsUser(3)
      Loc_Index = Loc_Index + 1
      RsUser.MoveNext
   Wend
   RsUser.Close
   CnUser.Close
   
End Sub

Private Sub Next_Button_Click()
   'Init the variables
   STID1 = ""
   STIT1 = ""
   STID2 = ""
   STIT2 = ""
   STID3 = ""
   STIT3 = ""
   STID4 = ""
   STIT4 = ""
   STID5 = ""
   STIT5 = ""
   STID6 = ""
   STIT6 = ""
   STID7 = ""
   STIT7 = ""
   CLINCOND = ""
   
   CnUser.Open ConnectString
   Cmd.CommandText = "SELECT CLNTCODE, SEX" _
                  & " FROM   client" _
                  & " WHERE VISITID = " & VISITID
   Cmd.CommandType = adCmdText
   Cmd.ActiveConnection = CnUser
   RsUser.Open Cmd, , adOpenStatic
      CLIENTCO = RsUser(0)
      SEX = RsUser(1)
   RsUser.Close
   CnUser.Close
    
   If SEX = "1" Then
      ClinicSTIMaleResultForm.Show
   Else
      ClinicSTIFemaleResultForm.Show
   End If
   Unload Me
End Sub
